#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    int A, B, C, D, start, end, time;
    cin >> A >> B >> C >> D;
    start = A * 60 + B;
    end = C * 60 + D;
    time = end - start;
    if (time <= 0)
    {
        time += 24 * 60;
    }
    printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", time / 60, time % 60);
    return 0;
}

